Skip to content

feat(erc4626): use injected OAV input token for approvals - #35

Merged
Philippoes merged 2 commits into
mainfrom
eng-3209-oav-injected-input-token
Sep 18, 2026
Merged

Philippoes merged 2 commits into
mainfrom
eng-3209-oav-injected-input-token

Conversation

@ajag408

@ajag408 ajag408 commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add optional allocatorVaultInputTokenAddress on FeeConfiguration (types + JSON schema) and read it in the ERC-4626 validator.
  • Injected-OAV APPROVAL uses that token (including when it differs from the yield's base vault). Address-only injection still allows SUPPLY/WITHDRAW and no longer infers the parent token for APPROVAL.
  • Replace getBaseVaultForChain with synthesizeInjectedVault. Static vaultInfoMap lookup is unchanged.
  • @yieldxyz/shield stays at 1.7.0 on this branch (no version bump in this PR).

QA Proof

  • ERC-4626 unit tests: 140 passed (pnpm test -- erc4626.validator.test), including the context-injected allocator vaults (runtime OAV) suite. Screenshot attached.
  • Schema accept: handleJsonRequest with the new context field on a Lido stake tx returns ok: true (Lido ignores the ERC-4626 fields; the point is that the request is not SCHEMA_VALIDATION_ERROR):
{"ok":true,"apiVersion":"1.0","result":{"isValid":true,"detectedType":"STAKE"},"meta":{"requestHash":"259aec5a7b4ead52feff152073b8ea28fd9e9ccbd66b140cd5b57a9b41aa0ff5"}}
  • Full pnpm test reported 6122 passing assertions. The run exited non-zero because the Tron Jest worker crashed on circular req/res serialization — native-staking.validator.test.ts failed to run, not on an assertion. Unrelated to this change.

What Needs to Be QA'd in Staging

  • Injected OAV approval succeeds only when allocatorVaultInputTokenAddress matches tx.to
  • Injected OAV supply/withdraw still succeed with address-only feeConfiguration (no input-token field)
  • Static-registry allocator approval/supply unchanged when context is omitted
  • Meta-vault: injected token != parent vault input token still validates
  • Clients still on Day 1 address-only injection: APPROVAL of the parent token to an injected OAV is now blocked until they send the new field
  • Note: production ShieldValidationService does not populate context yet, so staging cannot fully exercise injected OAVs until that monorepo wiring lands. The Shield-side contract for this PR is the unit + schema checks above.

QA Team Notification

  • QA team has been notified to test in staging

Note

Medium Risk
Changes ERC-4626 approval whitelisting for context-injected OAVs and breaks address-only clients until they send allocatorVaultInputTokenAddress; SUPPLY/WITHDRAW behavior is preserved with fallback.

Overview
Adds optional allocatorVaultInputTokenAddress to validation context.feeConfiguration (types + JSON schema) so runtime-injected allocator vaults (OAVs) can declare which ERC-20 must be approved.

The ERC-4626 validator now tracks injected OAVs as address → input token and builds vault metadata via synthesizeInjectedVault instead of copying the yield’s base vault token for every injected address. SUPPLY/WITHDRAW still work with address-only allocatorVaultAddress (input token falls back to the base vault). APPROVAL to an injected OAV requires the new field: tx.to must match the declared input token, including meta-vault cases where that token differs from the parent vault’s USDC (etc.). Address-only injection no longer whitelists approvals to the parent input token.

Unit tests cover match/mismatch, omitted input token, and meta-vault approval paths.

Reviewed by Cursor Bugbot for commit 585b6b8. Configure here.

@ajag408
ajag408 added this pull request to stack #36 September 11, 2026 05:47
@ajag408 ajag408 changed the title Eng 3209 oav injected input token feat(erc4626): use injected OAV input token for approvals Sep 11, 2026
raiseerco
raiseerco previously approved these changes Sep 14, 2026

@raiseerco raiseerco left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

auralshin
auralshin previously approved these changes Sep 17, 2026
Base automatically changed from eng-3209-erc4626-runtime-oav-injection to main September 17, 2026 19:39
@ajag408
ajag408 dismissed stale reviews from auralshin and raiseerco via 585b6b8 September 17, 2026 19:39
@ajag408
ajag408 force-pushed the eng-3209-oav-injected-input-token branch from 34b92e8 to 585b6b8 Compare September 17, 2026 19:39

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Risk: medium. Left a non-blocking comment and did not approve: this changes ERC-4626 approval allowlisting for injected OAVs, which is above the low-risk approval threshold. Reviewers were not assigned because two or more are already requested.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router and Approver

@Philippoes
Philippoes merged commit 9000e38 into main Sep 18, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants